package com.yy.job.console.dto;

import java.util.ArrayList;
import java.util.List;

public class PageDTO<T> {
	
	/**
	 * 每页条数
	 */
	private Integer pageSize = 20;

	/**
	 * 当前页码
	 */
	private Integer currentPage = 1;
	
	/**
	 * 开始行数
	 */
	private Integer startRow;
	
	/**
	 * 条数
	 */
	private Integer totalItem;
	
	/**
	 * 结果集
	 */
	private List<T> resultList = new ArrayList<>();

	public PageDTO(Integer pageSize, Integer currentPage) {
		super();
		this.pageSize = pageSize;
		this.currentPage = currentPage;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public Integer getStartRow() {
		return startRow;
	}

	public void setStartRow(Integer startRow) {
		this.startRow = startRow;
	}
	
	public Integer getTotalItem() {
		return totalItem;
	}

	public void setTotalItem(Integer totalItem) {
		this.totalItem = totalItem;
	}

	public List<T> getResultList() {
		return resultList;
	}

	public void setResultList(List<T> resultList) {
		this.resultList = resultList;
	}

	public Integer calStartRow() {
		return currentPage <= 0 ? 0 : (currentPage-1) * pageSize;
	}
	
}
